//
//  SISSBookingIntermediaryServicesBaseCell.m
//  SISSAPP
//
//  Created by 袁应荣 on 2017/9/30.
//  Copyright © 2017年 优房网. All rights reserved.
//

#import "SISSBookingIntermediaryServicesBaseCell.h"

@implementation SISSBookingIntermediaryServicesBaseCell



- (NSMutableAttributedString *)getTextAttritedStrWithAttachText:(NSMutableAttributedString *)attachTextM strs:(NSArray *)strArr textFields:(NSArray <UITextField *>*)textFields keyboardType:(UIKeyboardType)keyboardType placeHolders:(NSArray *)placeHolders {
    
    UIFont *font = [UIFont systemFontOfSize:16];
    for (NSInteger i = 0; i < textFields.count; i++) {
        UITextField *textField = textFields[i];
        textField.delegate = self;
        textField.textColor = MAIN_TEXT_COLOR;
        textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@" " attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:16],NSForegroundColorAttributeName:SECONDARY_TEXT_COLOR}];
        textField.keyboardType = keyboardType;
        textField.placeholder = (placeHolders.count > 0) && ((NSString *)placeHolders.firstObject).length > 0 ? [NSString stringWithFormat:@"%@   ",placeHolders[i]] : @" 几     ";
        textField.textAlignment = NSTextAlignmentCenter;
//        textField.userInteractionEnabled = NO;
        [textField sizeToFit];
        UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(10,0,10,26)];
        leftView.backgroundColor = [UIColor clearColor];
        textField.leftView = leftView;
        textField.leftViewMode = UITextFieldViewModeAlways;
        textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;
        
        NSMutableAttributedString *attachText = [NSMutableAttributedString yy_attachmentStringWithContent:textField contentMode:UIViewContentModeCenter attachmentSize:textField.bounds.size alignToFont:font alignment:(YYTextVerticalAlignment)YYTextVerticalAlignmentCenter];
        [attachTextM appendAttributedString:attachText];
        [attachTextM appendAttributedString:[[NSAttributedString alloc] initWithString:strArr[i] attributes:nil]];
    }
    attachTextM.yy_color = SECONDARY_TEXT_COLOR;
    attachTextM.yy_font = font;
    return attachTextM;
}

- (UIButton *)creatButtonWithTag:(NSInteger)tag {
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setImage:[UIImage imageNamed:@"check"] forState:UIControlStateNormal];
    [button setImage:[UIImage imageNamed:@"mainCheckSelected"] forState:UIControlStateSelected];
    [button addTarget:self action:@selector(checkButtonClickAction:) forControlEvents:UIControlEventTouchUpInside];
    button.tag = tag;
    return button;
}

- (void)checkButtonClickAction:(UIButton *)button {
    
}

@end
